<?php

/**
 * 支付密码
 *
 * Created by PhpStorm.
 * User: evan
 * Date: 16/9/7
 * Time: 下午8:32
 */
class Pay_password extends MY_Api_Controller
{
    /**
     * 设置支付密码
     */
    public function set()
    {
        $uid          = $this->uid;
        $mobile       = trim($this->input->get_post('mobile'));
        $verify_code  = trim($this->input->get_post('code'));
        $pay_password = trim($this->input->get_post('pay_password'));


        $this->load->service('finance/service_finance_pay_password');
        $data = $this->service_finance_pay_password->set($uid, $mobile, $verify_code, $pay_password);


        $this->json_output($data['data'], $data['status']);
    }


    /**
     * 修改支付密码
     */
    public function modify()
    {
        $uid             = $this->uid;
        $mobile          = trim($this->input->get_post('mobile'));
        $verify_code     = trim($this->input->get_post('code'));
        $pay_password    = trim($this->input->get_post('pay_password'));
        $re_pay_password = trim($this->input->get_post('re_pay_password'));


        $this->load->service('finance/service_finance_pay_password');
        $data = $this->service_finance_pay_password->modify($uid, $mobile, $verify_code, $pay_password, $re_pay_password);


        $this->json_output($data['data'], $data['status']);
    }


    public function modify_new()
    {
        $uid          = $this->uid;
        $old_password = trim($this->input->get_post('old_password'));
        $password     = trim($this->input->get_post('password'));


        $this->load->service('finance/service_finance_pay_password');
        $data = $this->service_finance_pay_password->modify_new($uid, $old_password, $password);


        $this->json_output($data['data'], $data['status']);
    }



    /**
     * 验证用户支付密码
     */
    public function verify()
    {
        $uid          = $this->uid;
        $pay_password = trim($this->input->get_post('pay_password'));


        $this->load->service('finance/service_finance_pay_password');
        $data = $this->service_finance_pay_password->verify($uid, $pay_password);


        $this->json_output($data['data'], $data['status']);
    }
}